<?php
class Application_Model_Filter_TodoTaskSearch {
    /**
     * 快速搜索
     */
    public $quick;
    /**
     * 时间格式
     */
    public $timescope;
    /**
     * 开始时间
     */
    public $startTime;
    /**
     * 结束时间
     */
    public $endTime;
    /**
     * 创建人
     */
    public $creator;
    /**
     * 事项名称
     */
    public $title;
    /**
     * 事项类型
     */
    public $nametitle;
    /**
     * 优先级别
     */
    public $objectpriority;
    /**
     * 执行状态  
     */
    public $status;
    
    
    function getSearchFileds()
    {
        $where = array();
        $and = "";
        if($this->quick != ""){
            $where[" objectType = "] = $this->quick;
            $and = " and ";
        }
        if($this->nametitle != ""){
            $where[$and ." ( creator like "] ="%" . $this->nametitle ."%";
             $where[" or title like "] ="%" . $this->nametitle ."%";
            $where[" ) and 1 = "] =1;
            $and = " and ";
        }
        if($this->startTime != ""){
            $where[$and . " dateCreated >= "] = $this->startTime;
            $and = " and ";
        }
        if($this->endTime != ""){
            $where[$and . " dateCreated <= "] = $this->endTime." 23:59:59";
            $and = " and ";
        }
        if($this->objectpriority != ""){
            $where[$and." priority = "] = $this->objectpriority;
            $and = " and ";
        }
        if($this->status != ""){
            $where[$and." status = "] = $this->status;
            $and = " and ";
        }
        return $where;
    }
}
